|
1
|
|
|
/** |
|
2
|
|
|
* Nextcloud - passman |
|
3
|
|
|
* |
|
4
|
|
|
* @copyright Copyright (c) 2016, Sander Brand ([email protected]) |
|
5
|
|
|
* @copyright Copyright (c) 2016, Marcos Zuriaga Miguel ([email protected]) |
|
6
|
|
|
* @license GNU AGPL version 3 or any later version |
|
7
|
|
|
* |
|
8
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
9
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
10
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
11
|
|
|
* License, or (at your option) any later version. |
|
12
|
|
|
* |
|
13
|
|
|
* This program is distributed in the hope that it will be useful, |
|
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16
|
|
|
* GNU Affero General Public License for more details. |
|
17
|
|
|
* |
|
18
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
19
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
20
|
|
|
* |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
(function () { |
|
24
|
|
|
'use strict'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @ngdoc overview |
|
28
|
|
|
* @name passmanApp |
|
29
|
|
|
* @description |
|
30
|
|
|
* # passmanApp |
|
31
|
|
|
* |
|
32
|
|
|
* Main module of the application. |
|
33
|
|
|
*/ |
|
34
|
|
|
angular |
|
35
|
|
|
.module('passmanApp', [ |
|
36
|
|
|
'ngAnimate', |
|
37
|
|
|
'ngCookies', |
|
38
|
|
|
'ngResource', |
|
39
|
|
|
'ngRoute', |
|
40
|
|
|
'ngSanitize', |
|
41
|
|
|
'ngTouch', |
|
42
|
|
|
'templates-main', |
|
43
|
|
|
'LocalStorageModule', |
|
44
|
|
|
'offClick', |
|
45
|
|
|
'ngPasswordMeter', |
|
46
|
|
|
'ngclipboard', |
|
47
|
|
|
'xeditable', |
|
48
|
|
|
'ngTagsInput', |
|
49
|
|
|
'angularjs-datetime-picker', |
|
50
|
|
|
'ui.sortable' |
|
51
|
|
|
]) |
|
52
|
|
|
.config(function ($routeProvider) { |
|
53
|
|
|
$routeProvider |
|
54
|
|
|
.when('/', { |
|
55
|
|
|
templateUrl: 'views/vaults.html', |
|
56
|
|
|
controller: 'VaultCtrl' |
|
57
|
|
|
}) |
|
58
|
|
|
.when('/vault/:vault_id', { |
|
59
|
|
|
templateUrl: 'views/show_vault.html', |
|
60
|
|
|
controller: 'CredentialCtrl' |
|
61
|
|
|
}) |
|
62
|
|
|
.when('/vault/:vault_id/new', { |
|
63
|
|
|
templateUrl: 'views/edit_credential.html', |
|
64
|
|
|
controller: 'CredentialEditCtrl' |
|
65
|
|
|
}) |
|
66
|
|
|
.when('/vault/:vault_id/edit/:credential_id', { |
|
67
|
|
|
templateUrl: 'views/edit_credential.html', |
|
68
|
|
|
controller: 'CredentialEditCtrl' |
|
69
|
|
|
}).when('/vault/:vault_id/:credential_id/share', { |
|
70
|
|
|
templateUrl: 'views/share_credential.html', |
|
71
|
|
|
controller: 'ShareCtrl' |
|
72
|
|
|
}).when('/vault/:vault_id/:credential_id/revisions', { |
|
73
|
|
|
templateUrl: 'views/credential_revisions.html', |
|
74
|
|
|
controller: 'RevisionCtrl' |
|
75
|
|
|
}) |
|
76
|
|
|
.when('/vault/:vault_id/settings', { |
|
77
|
|
|
templateUrl: 'views/settings.html', |
|
78
|
|
|
controller: 'SettingsCtrl' |
|
79
|
|
|
}) |
|
80
|
|
|
.otherwise({ |
|
81
|
|
|
redirectTo: '/' |
|
82
|
|
|
}); |
|
83
|
|
|
}).config(['$httpProvider', function ($httpProvider) { |
|
84
|
|
|
$httpProvider.defaults.headers.common.requesttoken = oc_requesttoken; |
|
|
|
|
|
|
85
|
|
|
}]).config(function (localStorageServiceProvider) { |
|
86
|
|
|
localStorageServiceProvider |
|
87
|
|
|
.setNotify(true, true); |
|
88
|
|
|
}); |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* jQuery for notification handling D: |
|
92
|
|
|
**/ |
|
93
|
|
|
jQuery(document).ready(function () { |
|
94
|
|
|
var findItemByID = function (id) { |
|
95
|
|
|
var credentials, foundItem = false; |
|
96
|
|
|
credentials = angular.element('#app-content-wrapper').scope().credentials; |
|
97
|
|
|
angular.forEach(credentials, function (credential) { |
|
98
|
|
|
if (credential.credential_id === id) { |
|
99
|
|
|
foundItem = credential; |
|
100
|
|
|
} |
|
101
|
|
|
}); |
|
102
|
|
|
return foundItem; |
|
103
|
|
|
}; |
|
104
|
|
|
jQuery(document).on('click', '.undoDelete', function () { |
|
105
|
|
|
var credential = findItemByID($(this).attr('data-item-id')); |
|
106
|
|
|
angular.element('#app-content-wrapper').scope().recoverCredential(credential); |
|
107
|
|
|
//Outside anglular we need $apply |
|
108
|
|
|
angular.element('#app-content-wrapper').scope().$apply(); |
|
109
|
|
|
}); |
|
110
|
|
|
jQuery(document).on('click', '.undoRestore', function () { |
|
111
|
|
|
var credential = findItemByID($(this).attr('data-item-id')); |
|
112
|
|
|
angular.element('#app-content-wrapper').scope().deleteCredential(credential); |
|
113
|
|
|
//Outside anglular we need $apply |
|
114
|
|
|
angular.element('#app-content-wrapper').scope().$apply(); |
|
115
|
|
|
}); |
|
116
|
|
|
}); |
|
117
|
|
|
}()); |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.